import os
from PIL import Image

def change_name(path, kind):
    images = os.listdir(path)
    for names in images:
        os.rename(path+names, path+kind+'_'+names.split('.')[0]+'.png')

def change_size(inputimg, outputimg, width=32, height=32):
    img = Image.open('./FA/test/'+inputimg)
    new_image = img.resize((width, height), Image.BILINEAR)
    new_image.save(os.path.join(outputimg, os.path.basename(inputimg)))

for inputimg in os.listdir('./FA/test/'):
    change_size(inputimg, './FA/test/')

# change_name('./FA/fruit/orange/', '9')